<template>
  <div>
    <banner></banner>
    <div class="questionsContent">
      <header>当前第1题/共8题</header>
      <p>1.你选择学习的课程是？（单选）</p>
      <radio-group class="radioGroup"
        @change="getRadioValue"
      >
        <label
        @click="reasonMsg(index)"
          class="radio"
          v-for="(item,index) in subData"
          :index="index"
          :key="index"
        >
          <radio 
             :value="item.value" />
          <span>{{item.value}}</span>
        </label>
      </radio-group>
      <button @click="PlusIndex" type="primary">下一题</button>
    </div>
  </div>
</template>

<script>
import banner from "@/components/questionBanner.vue"
import Vue from "vue"
export default {
  data() {
    return {
      subData: [
        { value: "A.软件工程师" },
        { value: "B.ACCP" },
        { value: "C.北美大数据工程师" },
        { value: "D.JAVA中级程序员" },
        { value: "E.互联网架构师" },
        { value: "F.Web前端工程师" },
        { value: "G.UI设计师" },
        { value: "H.Python工程师" },
        { value: "I.云计算工程师" }
      ],
      currentIndex: ""
    };
  },
  components: {
    banner
  },
  methods: {
    PlusIndex() {
      if (this.currentIndex==='') {
        wx.showToast({
          title: "不能为空",
          duration: 2000,
          icon: "none"
        });
      } else {
        wx.navigateTo({ url: "../questionTwo/main" });
      }
    },
    reasonMsg(index,e) {
      this.currentIndex = index;
      
    },
    getRadioValue(e) {
      Vue.prototype.course = e.mp.detail.value
    }
  },
  created() {},
  onLoad() {}
};
</script>

<style scoped>
</style>
